package yrl.socket;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class RadiusClient {

	public static void main(String[] args) throws UnknownHostException, IOException {
		Socket client=new Socket("localhost", 8888);
		Scanner scanner=new Scanner(System.in);
		DataInputStream inputFromServer=new DataInputStream(client.getInputStream());
		DataOutputStream outputToServer=new DataOutputStream(client.getOutputStream());
		while(true) {
			System.out.println("请输入半径：");
			double radius=scanner.nextDouble();
			outputToServer.writeDouble(radius);
			outputToServer.flush();
			double area=inputFromServer.readDouble();
			System.out.println("客户端：输入的半径是："+radius);
			System.out.println("客户端收到的圆的面积是："+area);
		}
	}

}
